<?php
if (!isset($GLOBALS['kindeditor'])) {
    echo('<script charset="utf-8" src="./adminassets/kindeditor.js"></script>');
    $GLOBALS['kindeditor'] = 1;
}
?>
<textarea class=" <?php echo($class);?>" <?php echo($style); ?> id="<?php echo($inputname); ?>" name="<?php echo($inputname); ?>" cols="150"
                                rows="30"><?php echo($inputvalue); ?></textarea>

<script type="text/javascript">
    var <?php echo($inputname);?>;
    KindEditor.ready(function (K) {
        <?php echo($inputname);?> = K.create('#<?php echo($inputname);?>', {
            resizeType: 1,
            allowPreviewEmoticons: false,
            allowImageUpload: true,
            filterMode: false,
            uploadJson: 'upload.php',
            afterChange: function () {
                // console.log("编辑完成");
                this.sync();
            }, afterBlur: function () {
                this.sync();
            },

            items: [
                'source', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'image', 'link']
        });
    });
</script>